package br.art.late.openenvironment.boids;

import br.art.late.openenvironment.main.OpenEnvironment;
import processing.core.PVector;

public /**
 * Obj class for Processing, Nicolas Liautaud 2009 <br/>
 * Used for boids simulation
 */

class Obj {
	private PVector pos;
	private float rad;
	private float aura;
	private OpenEnvironment parent;

	public Obj(OpenEnvironment parent) {
		this.parent = parent;
		init(((OpenEnvironment) parent).getBoids().zone.randomPos());
	}

	public Obj(int x, int y, OpenEnvironment parent) {
		this.parent = parent;
		init(new PVector(x, y));
	}

	public void init(PVector p) {
		setPos(p);
		setRad(4);
		setAura(getRad());
	}

	public void display() {
		display(100, 100, 100);
	}

	public void display(int r, int g, int b) {
		parent.fill(r, g, b, 250);
		//parent.stroke(r, g, b);
		parent.ellipse(getPos().x, getPos().y, getRad() * 2, getRad() * 2);
	}

	/**
	 * @return the parent
	 */
	OpenEnvironment getParent() {
		return parent;
	}

	/**
	 * @param parent the parent to set
	 */
	void setParent(OpenEnvironment parent) {
		this.parent = parent;
	}

	/**
	 * @return the aura
	 */
	public float getAura() {
		return aura;
	}

	/**
	 * @param aura the aura to set
	 */
	public void setAura(float aura) {
		this.aura = aura;
	}

	/**
	 * @return the rad
	 */
	public float getRad() {
		return rad;
	}

	/**
	 * @param rad the rad to set
	 */
	public void setRad(float rad) {
		this.rad = rad;
	}

	/**
	 * @return the pos
	 */
	public PVector getPos() {
		return pos;
	}

	/**
	 * @param pos the pos to set
	 */
	public void setPos(PVector pos) {
		this.pos = pos;
	}
}